package com.naver.java3d;

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.GraphicsConfiguration;

import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;

import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.SimpleUniverse;

public class SimpleProgram extends Applet {

	public SimpleProgram() {
		setLayout(new BorderLayout());
		GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
		Canvas3D canvas = new Canvas3D(config);
		add("Center", canvas);

		BranchGroup bg = new BranchGroup();
		bg.addChild(new ColorCube(0.4));
		bg.compile();

		SimpleUniverse u = new SimpleUniverse(canvas);

		u.getViewingPlatform().setNominalViewingTransform();
		u.addBranchGraph(bg);

	}

	public static void main(String[] args) {

		Frame f = new MainFrame(new SimpleProgram(), 512, 512);
	}

}
